package com.itheima.servlet;


import javax.servlet.ServletOutputStream;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet("/demo2")
public class Demo02 extends HttpServlet {


    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp){
        try {
            req.setCharacterEncoding("UTF-8");
            resp.setContentType("text/html;charset=UTF-8");
            PrintWriter pw = resp.getWriter();
            pw.write("你好");
            pw.write("<br/>");
            pw.write("世界");
            pw.write("<hr/>");
            pw.write("<img src='/001.jpg'/>");
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
